package com.jgdt.demo.widget;
import android.view.View;
import android.view.ViewGroup;
import com.librariy.json.JsonArray;
import com.librariy.json.JsonObject;
import com.librariy.view.AsyncListView;

import java.util.List;
public abstract class JsonListAdapter extends AsyncListView.AsyncListAdapter<JsonObject> {
    public JsonListAdapter() {
        super();
    }
    public void reload() {
        if (listView != null) {
            listView.loadMore(0);
        }
    }
    protected abstract void loadData(final int position, final int pageNum, final int pageSize);
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        return null;
    }
    public List<JsonObject> convert(final JsonArray retList) {
        for (int i = 0; i < retList.size(); i++) {
            if (retList.get(i) instanceof JsonObject)
                continue;
            retList.set(i, new JsonObject());
        }
        return retList;
    }
}